package ThreadBasic.yan;

import java.util.Comparator;

/**
 * @author yyh
 * @create 2020-11-05 12:19
 */
public class Person implements Comparator<Person>{

    public String name;
    public int age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int compare(Person o1, Person o2) {
        return o1.age - o2.age;
    }
}
